<template>
	<div>
		<div>
			<el-form :model="searchForm" ref="searchForm">
				<el-form-item label="手机号">
					<el-input placeholder="请输入手机号" v-model="searchForm.contact_tel" clearable />
				</el-form-item>
			</el-form>
		</div>
		<div>
			<el-table :data="tableData" border style="width: 100%">
				<el-table-column fixed prop="sale_user_id" label="ID" />
				<el-table-column prop="contact_tel" label="账号" />
				<el-table-column prop="contact_tel" label="手机号" />
				<el-table-column prop="faname" label="姓名" />
				<el-table-column prop="people" label="已推广订单数" />
				<el-table-column prop="rate_money" label="已获取佣金" />
				<el-table-column prop="create_time" label="入驻时间" />
				<el-table-column prop="people" label="账号有效期">
					<template slot-scope="scope">
						{{ scope.row.create_time }}-<br>
						{{ scope.row.end_time }}
					</template>
				</el-table-column>
				<el-table-column fixed="right" label="操作">
					<template slot-scope="scope">
						<el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
						<el-button @click="handleEdit(scope.row)" type="text" size="small">编辑</el-button>
					</template>
				</el-table-column>
			</el-table>
			<custom-page ref="customPage" :total="total" @getList="getList" />
		</div>
	</div>
</template>

<script>
import customPage from '@/components/customPage'
export default {
	data() {
		return {
			tableData: [],
			searchForm: {
				contact_tel: ''
			},
			sale_user_id: 0,
			sale_user_id_eidt: 0,
			editList: {}
		}
	},
	mounted() {
		this.getList()
	},
	method: {
		getList(flag) {
			const {
				page,
				pageSize
			} = {
				page: this.page,
				pageSize: this.pageSize
			}
			if (!flag) {
				this.tableData = []
			}
			saleUserList({
				page,
				pageSize,
				contact_tel: this.searchForm.contact_tel
			}).then(res => {
				this.tableData = res.data
				this.total = res.total
				console.log(res);
			})
		},
		handleClick(item) {
			this.editList = item
			this.sale_user_id = item.sale_user_id
			console.log("this.sale_user_id", this.sale_user_id);
			this.$refs.centerDialog.dialogVisible = true
		},
		handleEdit(item) {
			this.editList = item
			console.log(item.sale_user_id);
			this.sale_user_id_eidt = item.sale_user_id
			this.$refs.editDialog.dialogVisible = true
		}
	}
}
</script>

<style>

</style>